# Copyright 2019 The IREE Authors
#
# Licensed under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

load("//build_tools/bazel:enforce_glob.bzl", "enforce_glob")
load("//build_tools/bazel:iree_lit_test.bzl", "iree_lit_test_suite")

package(
    features = ["layering_check"],
    licenses = ["notice"],  # Apache 2.0
)

iree_lit_test_suite(
    name = "lit",
    srcs = enforce_glob(
        [
            "annotate_dispatches.mlir",
            "capture_dispatch_dynamic_dims.mlir",
            "cleanup_tensor_shapes.mlir",
            "clone_producers_into_dispatch_regions.mlir",
            "collapse_reduction.mlir",
            "convert_region_to_workgroups.mlir",
            "deduplicate_executables.mlir",
            "dispatch_linalg_on_tensors.mlir",
            "collapse_linalg_generic_on_tensors.mlir",
            "dispatch_linalg_on_tensors_default.mlir",
            "dispatch_linalg_on_tensors_fusion_with_transpose.mlir",
            "dispatch_linalg_transform_dialect.mlir",
            "export_benchmark_funcs.mlir",
            "fold_unit_dims.mlir",
            "form_dispatch_regions.mlir",
            "form_dispatch_workgroups.mlir",
            "form_scalar_dispatches.mlir",
            "fusion_of_tensor_ops.mlir",
            "initialize_empty_tensors.mlir",
            "inject_dispatch_tracing.mlir",
            "insert_dispatch_debug_markers.mlir",
            "interchange_generic_ops.mlir",
            "interchange_transpose_generic_ops.mlir",
            "outline_dispatch_externs.mlir",
            "outline_dispatch_regions.mlir",
            "pad_fusion_with_consumer.mlir",
            "pad_fusion_with_producer.mlir",
            "pipeline_tests.mlir",
            "tensor_pad_to_tensor_insert_slice.mlir",
            "top_level_scf_to_cfg.mlir",
            "transform_dispatch_region_formation.mlir",
            "verify_input_ir.mlir",
        ],
        include = ["*.mlir"],
        # transform_dialect_dispatch_spec is a an MLIR file that specifies a
        # transformation, it needs to be included as data.
        exclude = [
            "transform_dialect_dispatch_spec.mlir",
        ],
    ),
    cfg = "//compiler:lit.cfg.py",
    data = ["transform_dialect_dispatch_spec.mlir"],
    tools = [
        "//tools:iree-opt",
        "@llvm-project//llvm:FileCheck",
    ],
)
